3.1.39 \(\int \cot ^2(c+d x) (a+i a \tan (c+d x))^4 \, dx\) [39]

Optimal. Leaf size=71 \[ -8 a^4 x+\frac {4 i a^4 \log (\cos (c+d x))}{d}+\frac {4 i a^4 \log (\sin (c+d x))}{d}-\frac {\cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{d} \]

[Out]

-8*a^4*x+4*I*a^4*ln(cos(d*x+c))/d+4*I*a^4*ln(sin(d*x+c))/d-cot(d*x+c)*(a^2+I*a^2*tan(d*x+c))^2/d

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 71, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3634, 12, 3622, 3556} \begin {gather*} \frac {4 i a^4 \log (\sin (c+d x))}{d}+\frac {4 i a^4 \log (\cos (c+d x))}{d}-8 a^4 x-\frac {\cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^2*(a + I*a*Tan[c + d*x])^4,x]

[Out]

-8*a^4*x + ((4*I)*a^4*Log[Cos[c + d*x]])/d + ((4*I)*a^4*Log[Sin[c + d*x]])/d - (Cot[c + d*x]*(a^2 + I*a^2*Tan[
c + d*x])^2)/d

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3622

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(2*
b*c - a*d)*(x/b^2), x] + (Dist[d^2/b, Int[Tan[e + f*x], x], x] + Dist[(b*c - a*d)^2/b^2, Int[1/(a + b*Tan[e +
f*x]), x], x]) /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0]

Rule 3634

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim
p[(-a^2)*(b*c - a*d)*(a + b*Tan[e + f*x])^(m - 2)*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(b*c + a*d)*(n + 1))), x]
 + Dist[a/(d*(b*c + a*d)*(n + 1)), Int[(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[e + f*x])^(n + 1)*Simp[b*(b*c*(
m - 2) - a*d*(m - 2*n - 4)) + (a*b*c*(m - 2) + b^2*d*(n + 1) - a^2*d*(m + n - 1))*Tan[e + f*x], x], x], x] /;
FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[m, 1] && Lt
Q[n, -1] && (IntegerQ[m] || IntegersQ[2*m, 2*n])

Rubi steps

\begin {align*} \int \cot ^2(c+d x) (a+i a \tan (c+d x))^4 \, dx &=-\frac {\cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{d}-\int -4 i a^2 \cot (c+d x) (a+i a \tan (c+d x))^2 \, dx\\ &=-\frac {\cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{d}+\left (4 i a^2\right ) \int \cot (c+d x) (a+i a \tan (c+d x))^2 \, dx\\ &=-8 a^4 x-\frac {\cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{d}+\left (4 i a^4\right ) \int \cot (c+d x) \, dx-\left (4 i a^4\right ) \int \tan (c+d x) \, dx\\ &=-8 a^4 x+\frac {4 i a^4 \log (\cos (c+d x))}{d}+\frac {4 i a^4 \log (\sin (c+d x))}{d}-\frac {\cot (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )^2}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(151\) vs. \(2(71)=142\).
time = 1.55, size = 151, normalized size = 2.13 \begin {gather*} \frac {a^4 \csc (c) \csc (c+d x) \sec (c) \sec (c+d x) \left (6 d x \cos (4 c+2 d x)-i \cos (4 c+2 d x) \log \left (\cos ^2(c+d x)\right )+\cos (2 d x) \left (-6 d x+i \log \left (\cos ^2(c+d x)\right )+i \log \left (\sin ^2(c+d x)\right )\right )-i \cos (4 c+2 d x) \log \left (\sin ^2(c+d x)\right )+2 \sin (2 d x)+4 \text {ArcTan}(\tan (5 c+d x)) \sin (2 c) \sin (2 (c+d x))\right )}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^2*(a + I*a*Tan[c + d*x])^4,x]

[Out]

(a^4*Csc[c]*Csc[c + d*x]*Sec[c]*Sec[c + d*x]*(6*d*x*Cos[4*c + 2*d*x] - I*Cos[4*c + 2*d*x]*Log[Cos[c + d*x]^2]
+ Cos[2*d*x]*(-6*d*x + I*Log[Cos[c + d*x]^2] + I*Log[Sin[c + d*x]^2]) - I*Cos[4*c + 2*d*x]*Log[Sin[c + d*x]^2]
 + 2*Sin[2*d*x] + 4*ArcTan[Tan[5*c + d*x]]*Sin[2*c]*Sin[2*(c + d*x)]))/(4*d)

________________________________________________________________________________________

Maple [A]
time = 0.18, size = 80, normalized size = 1.13

method result size
risch \(\frac {16 a^{4} c}{d}-\frac {4 i a^{4}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}+\frac {4 i a^{4} \ln \left ({\mathrm e}^{4 i \left (d x +c \right )}-1\right )}{d}\) \(67\)
derivativedivides \(\frac {a^{4} \left (\tan \left (d x +c \right )-d x -c \right )+4 i a^{4} \ln \left (\cos \left (d x +c \right )\right )-6 a^{4} \left (d x +c \right )+4 i a^{4} \ln \left (\sin \left (d x +c \right )\right )+a^{4} \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) \(80\)
default \(\frac {a^{4} \left (\tan \left (d x +c \right )-d x -c \right )+4 i a^{4} \ln \left (\cos \left (d x +c \right )\right )-6 a^{4} \left (d x +c \right )+4 i a^{4} \ln \left (\sin \left (d x +c \right )\right )+a^{4} \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) \(80\)
norman \(\frac {\frac {a^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {a^{4}}{d}-8 a^{4} x \tan \left (d x +c \right )}{\tan \left (d x +c \right )}+\frac {4 i a^{4} \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {4 i a^{4} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) \(83\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^4,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^4*(tan(d*x+c)-d*x-c)+4*I*a^4*ln(cos(d*x+c))-6*a^4*(d*x+c)+4*I*a^4*ln(sin(d*x+c))+a^4*(-cot(d*x+c)-d*x-c
))

________________________________________________________________________________________

Maxima [A]
time = 0.50, size = 67, normalized size = 0.94 \begin {gather*} -\frac {8 \, {\left (d x + c\right )} a^{4} + 4 i \, a^{4} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 4 i \, a^{4} \log \left (\tan \left (d x + c\right )\right ) - a^{4} \tan \left (d x + c\right ) + \frac {a^{4}}{\tan \left (d x + c\right )}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^4,x, algorithm="maxima")

[Out]

-(8*(d*x + c)*a^4 + 4*I*a^4*log(tan(d*x + c)^2 + 1) - 4*I*a^4*log(tan(d*x + c)) - a^4*tan(d*x + c) + a^4/tan(d
*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 0.40, size = 58, normalized size = 0.82 \begin {gather*} -\frac {4 \, {\left (i \, a^{4} + {\left (-i \, a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + i \, a^{4}\right )} \log \left (e^{\left (4 i \, d x + 4 i \, c\right )} - 1\right )\right )}}{d e^{\left (4 i \, d x + 4 i \, c\right )} - d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^4,x, algorithm="fricas")

[Out]

-4*(I*a^4 + (-I*a^4*e^(4*I*d*x + 4*I*c) + I*a^4)*log(e^(4*I*d*x + 4*I*c) - 1))/(d*e^(4*I*d*x + 4*I*c) - d)

________________________________________________________________________________________

Sympy [A]
time = 0.19, size = 51, normalized size = 0.72 \begin {gather*} - \frac {4 i a^{4}}{d e^{4 i c} e^{4 i d x} - d} + \frac {4 i a^{4} \log {\left (e^{4 i d x} - e^{- 4 i c} \right )}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**2*(a+I*a*tan(d*x+c))**4,x)

[Out]

-4*I*a**4/(d*exp(4*I*c)*exp(4*I*d*x) - d) + 4*I*a**4*log(exp(4*I*d*x) - exp(-4*I*c))/d

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 163 vs. \(2 (65) = 130\).
time = 1.02, size = 163, normalized size = 2.30 \begin {gather*} -\frac {-8 i \, a^{4} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) + 32 i \, a^{4} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) - 8 i \, a^{4} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - 8 i \, a^{4} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) - a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {-8 i \, a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 5 \, a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 8 i \, a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{4}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+I*a*tan(d*x+c))^4,x, algorithm="giac")

[Out]

-1/2*(-8*I*a^4*log(tan(1/2*d*x + 1/2*c) + 1) + 32*I*a^4*log(tan(1/2*d*x + 1/2*c) + I) - 8*I*a^4*log(tan(1/2*d*
x + 1/2*c) - 1) - 8*I*a^4*log(tan(1/2*d*x + 1/2*c)) - a^4*tan(1/2*d*x + 1/2*c) - (-8*I*a^4*tan(1/2*d*x + 1/2*c
)^3 - 5*a^4*tan(1/2*d*x + 1/2*c)^2 + 8*I*a^4*tan(1/2*d*x + 1/2*c) + a^4)/(tan(1/2*d*x + 1/2*c)^3 - tan(1/2*d*x
 + 1/2*c)))/d

________________________________________________________________________________________

Mupad [B]
time = 4.00, size = 63, normalized size = 0.89 \begin {gather*} \frac {a^4\,\mathrm {tan}\left (c+d\,x\right )}{d}-\frac {a^4\,\mathrm {cot}\left (c+d\,x\right )}{d}-\frac {a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,8{}\mathrm {i}}{d}+\frac {a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,4{}\mathrm {i}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)^2*(a + a*tan(c + d*x)*1i)^4,x)

[Out]

(a^4*tan(c + d*x))/d - (a^4*cot(c + d*x))/d - (a^4*log(tan(c + d*x) + 1i)*8i)/d + (a^4*log(tan(c + d*x))*4i)/d

________________________________________________________________________________________